package com.atguigu.hellomp;

import com.atguigu.hellomp.entity.User;
import com.atguigu.hellomp.mapper.UserMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class T4 {

    @Autowired
    UserMapper userMapper;

    @Test
    public void a(){
        IPage<User> userIPage = new Page<>(2,2);
        userIPage.setCurrent(2);
        userIPage.setSize(2);
        IPage<User> pageResult = userMapper.selectPage(userIPage, null);
        List<User> records = pageResult.getRecords();
        System.out.println(records);

    }

    @Test
    public void b(){
        Page<User> userPage = new Page<>();
        userPage.setCurrent(2);
        userPage.setSize(2);
        List<User> users = userMapper.selectEmail(userPage);
        System.out.println(users);
    }

}
